// 存储token
export const setToken = (token) => {
    localStorage.setItem('token', token);
};

// 获取token
export const getToken = () => {
    return localStorage.getItem('token') || '';
};

// 存储用户信息
export const setUser = (user) => {
    localStorage.setItem('user', JSON.stringify(user));
};

// 获取用户信息
export const getUser = () => {
    return JSON.parse(localStorage.getItem('user') || '{}');
};

// 清除登录状态
export const clearAuth = () => {
    localStorage.removeItem('token');
    localStorage.removeItem('user');
};
